<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>Forgot password</title>
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/teacher_style.css">
<link rel="stylesheet"
	href="http://fonts.googleapis.com/css?family=Merriweather" />
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
</head>
<body class="nobg">
	<div class="container-white">
		<div class="login-container">
			<form action="" class="login-form">
				<h1 class="header">Reset your password</h1>
				<div class="info">Enter the email address and we'll send you
					instructions for resetting your password.</div>
				<div class="success">Your instrucions send</div>
				<div class="login-items">
					<div class="form-item">
						<label for="email">Email:</label> <input type="text" name="email"
							id="email" class="input" />
						<div class="clear"></div>
					</div>
					<div class="clear"></div>
				</div>
				<div class="login-options">
					<button class="btn-green" type="submit" id="reset">
						<span> Reset password </span>
					</button>
					<span style="margin-left: 10px;"> <a href="../teacher/login">Sign
							in</a> </span>
				</div>
			</form>
		</div>
	</div>
	<!-- container end-->

	<div id="footer"></div>
	<script>
		$(document).ready(function() {
			$("#reset").click(function(ev) {
				ev.preventDefault();
				var email = $("input[name=email]").val();
				$.ajax({
					url : "../sendnewpassword",
					type : "POST",
					data : "command=generatePassword&email=" + email,
					success : function(message) {
						if (message == 1) {
							$("input[name=email]").css("border-color","red");
						} else {
							alert("Please, check your Email.");
							window.location = "../teacher/login";
						}
					}
				});
			});
		});
	</script>
</body>